package student.aistar.day15.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class SingleThreadExecutorDemo {
    public static void main(String[] args) {
        //单线程化的线程池对象的构建
        ExecutorService executorService = Executors.newSingleThreadExecutor();

        for(int i = 0; i < 10; i++){
            //提交任务
            executorService.submit(() ->{
                System.out.println(Thread.currentThread().getName());
            });
        }
        //关闭资源
        executorService.shutdown();
    }
}
